package market

import (
	"gxcvu-ai/app/model"
	"gxcvu-ai/pkg/database"
)

type Market struct {
	model.BaseModal

	Title       string `json:"title,omitempty" gorm:"size:100"`
	SystemRole  string `json:"system_role,omitempty"`
	Avatar      string `json:"avatar,omitempty" gorm:"size:100"`
	Description string `json:"description,omitempty" gorm:"size:100"`
	Tags        string `json:"tags,omitempty" gorm:"size:100"`

	model.CommonTimestampsField
}

func (marketModel *Market) Create() {
	database.DB.Create(&marketModel)
}

func GetAll() ([]Market, error) {
	var markets []Market
	err := database.DB.Find(&markets).Error
	return markets, err
}
